package com.yiqi.liebang.feature.setting.model;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.suozhang.framework.entity.bo.UserInfoBo;
import com.yiqi.liebang.entity.bo.EditPrivacyBo;
import com.yiqi.liebang.entity.bo.PrivacyBo;
import com.yiqi.liebang.entity.bo.RegisterBo;
import com.yiqi.liebang.feature.setting.contract.EditContract;
import com.yiqi.liebang.feature.setting.contract.PrivacyContract;
import com.yiqi.liebang.feature.setting.dependencies.edit.DaggerEditModelComponent;
import com.yiqi.liebang.feature.setting.dependencies.login.DaggerPrivacyModelComponent;
import com.yiqi.liebang.framework.api.ApiLib;
import com.yiqi.liebang.framework.api.UserApi;

import javax.inject.Inject;

import io.reactivex.Observable;

public class EditModel implements EditContract.Model {

    @Inject
    UserApi api;


    @Inject
    public EditModel() {
        DaggerEditModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<String> editPwd(RegisterBo registerBo) {
        return api.editPwd(registerBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> editPhone(RegisterBo registerBo) {
        return api.editPhone(registerBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<RegisterBo> sendCode(RegisterBo registerBo) {
        return api.sendCode(registerBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> verificationCode(RegisterBo registerBo) {
        return api.verificationUser(registerBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<UserInfoBo> bindPhone(RegisterBo registerBo) {
        return api.bindPhone(registerBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
